package com.easy.life.controller;

import com.easy.life.common.R;
import com.easy.life.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/pay/rent/room")
    public R rentRoom(Integer way,Long userId,Integer day,Long roomId){
        return orderService.rentRoom(way,userId,day,roomId);
    }

    @GetMapping("/get/order")
    public R getOrder(@RequestParam Long id){
        return orderService.getOrders(id);
    }

    @GetMapping("/get/access/code")
    public R getAccessCode(@RequestParam Long orderId){
        return orderService.getAccessCode(orderId);
    }
}
